<div class="button-item border-spe-bottom">
    <button pButton type="text" class="ui-button-danger" icon="fa fa-times" (click)="delete($event)" *ngIf="selectedItem" label="删除"></button>
    <button pButton type="text" class="ui-button-warning" icon="fa fa-pencil-square-o" (click)="showSaveUpdateSchedule($event)"
        *ngIf="selectedItem" label="修改"></button>
    <button pButton type="text" class="ui-button-info" icon="fa fa-plus" (click)="showSaveUpdateSchedule($event)" label="新增"></button>
    <button pButton type="text" class="ui-button-info" icon="fa fa-plus" (click)="resume($event)" *ngIf="selectedItem && selectedItem.jobStatus == 'PAUSED'"
        label="启动"></button>
    <button pButton type="text" class="ui-button-info" icon="fa fa-plus" (click)="pause($event)" *ngIf="selectedItem && selectedItem.jobStatus == 'NORMAL'"
        label="暂停"></button>
    <button pButton type="text" class="ui-button-info" icon="fa fa-plus" (click)="pause($event)" label="运行一次"></button>
</div>

<div class="content-item">
    <p-table [columns]="cols" [value]="items" [resizableColumns]="true" selectionMode="single" [(selection)]="selectedItem" [rows]="10">
        <ng-template pTemplate="header" let-columns>
            <tr>
                <th *ngFor="let col of columns" [style.width]="col.width">
                    {{col.header}}
                </th>
            </tr>
        </ng-template>
        <ng-template pTemplate="body" let-rowData let-columns="columns">
            <tr [pSelectableRow]="rowData">
                <td *ngFor="let col of columns" style="text-align: center;">
                    <span *ngIf="col.field == 'jobStatus'">
                        <span [ngSwitch]="rowData['jobStatus']">
                            <i *ngSwitchCase="'NORMAL'" class="fa fa-cicle" title="正常"></i>
                            <i *ngSwitchCase="'PAUSED'" class="fa fa-pencil-square-o" title="暂停"></i>
                        </span>
                    </span>
                    <span *ngIf="col.field != 'jobStatus'">
                        {{rowData[col.field]}}
                    </span>
                </td>
            </tr>
        </ng-template>
        <ng-template pTemplate="emptymessage" let-columns>
            <tr>
                <td [attr.colspan]="cols.length">
                    该分组下没有需要调度的定时任务...
                </td>
            </tr>
        </ng-template>
    </p-table>
</div>